function capitaliseFirstLetter(string){ return string.charAt(0).toUpperCase() + string.slice(1); } function update_notification_field(reset){ "use strict"; var pid, logged_in, d, has_lic; pid=jQuery('.wew-id-for-notify').val(); logged_in=jQuery('#wew-is-logged-in').val(); has_lic=jQuery('#wew-has-lic').val(); if(reset){ jQuery('.wew-notification-action_wrapper.variations').html(""); }else{ if(parseInt(has_lic, 10)===1){ if(logged_in){ d=''; }else{ d=''; d +=''; d +=''; } d +=''; }else{ d='' + wew_ajax_object.texts.pending + ''; } setTimeout(function(){ jQuery('.wew-notification-action_wrapper.variations').html(d); }, 100); }} (function($){ "use strict"; $(function (){ var $productVariations, $oosType, $oosParent, $waitlistTable, $waitlistTable_checks, $waitlistTable_checks_header; $oosType=$.trim($('#oos-type').val()); $oosParent=$('#oos-parentid').length ? $('#oos-parentid').val():false; $('.type-product').on('click', '#wew-submit-email-to-notify', function(){ var pid, uemail, mesgarea, $loading; $loading=$(this).nextAll('img'); $loading.css('visibility', 'visible'); if($(this).parents('tr').length&&$oosParent){ pid=$(this).parents('tr').find('.wew-id-for-notify').val(); uemail=$.trim($(this).parents('tr').find('.wew-email-to-notify').val()); mesgarea=$(this).parents('tr').find('.wew-notification-action_wrapper'); }else{ pid=$.trim($('.wew-id-for-notify').val()); uemail=$.trim($('.wew-email-to-notify').val()); mesgarea=$('.wew-notification-action_wrapper'); } jQuery.ajax({ type: "post", url: wew_ajax_object.ajax_url, dataType: 'json', data: { action:'wew_save_to_db_callback', pid:pid, uemail:uemail, is_grouped: $oosType==="grouped" ? 1:0, parent_id: $oosParent, is_variation: $oosType==="variation"||($oosType==="stock"&&$('input[name="variation_id"]').length) ? 1:0, variation_id: $oosType==="variation"||($oosType==="stock"&&$('input[name="variation_id"]').length) ? parseInt($('input[name="variation_id"]').val()):0 }, success:function(data, textStatus, XMLHttpRequest){ $loading.css('visibility', 'hidden'); if(data&&(data.error===false||(data.error===true&&parseInt(data.code)===3))){ mesgarea.html('' + data.message + ''); }else{ if(data.message!==undefined){ alert(data.message); }} }, error:function(data, textStatus, XMLHttpRequest){ $loading.css('visibility', 'hidden'); console.log('error ajax - save wew'); }}); return false; }); $('.wew-email-to-notify').keyup(function(event){ if(event.keyCode===13){ $('#wew-submit-email-to-notify').click(); return false; }}); if($('.variations_form').length&&$('.variations_form').data('product_variations')){ $productVariations=$('.variations_form').data('product_variations'); $('input[name="variation_id"]').on('change', function(){ var selectedVal, cnt, cnnt=0, c, productInStock, okey, varTit=[], varDTitle=""; selectedVal=parseInt($(this).val()) > 0 ? parseInt($(this).val()):false ; if(selectedVal){ for(cnt=0; cnt < $productVariations.length; cnt++){ if(parseInt($productVariations[cnt].variation_id)===selectedVal){ productInStock=$productVariations[cnt].is_in_stock; if(productInStock===true&&!$productVariations[cnt].backorders_allowed){ update_notification_field(true); }else{ update_notification_field(false); }} }}else{ update_notification_field(true); }}); } if($('#author-waitlist-table').length){ $waitlistTable=$('#author-waitlist-table'); $waitlistTable_checks=$waitlistTable.find('tbody .check-column > input'); $waitlistTable_checks_header=$waitlistTable.find('thead .check-column > input'); $waitlistTable_checks.removeAttr('checked'); $waitlistTable_checks_header.removeAttr('checked'); jQuery('#author_waitlist_unsubscribe').attr('disabled', 'disabled'); $waitlistTable_checks.on('change', function(){ var selectedNum=$waitlistTable.find('tbody .check-column > input:checked').length, allNum=$waitlistTable.find('tbody .check-column > input').length; if($(this).attr("checked")!==undefined){ }else{ $waitlistTable_checks_header.removeAttr('checked'); } if(selectedNum===0){ jQuery('#author_waitlist_unsubscribe').attr('disabled', 'disabled'); }else{ if(selectedNum===allNum){ $waitlistTable_checks_header.attr('checked', 'checked'); } jQuery('#author_waitlist_unsubscribe').removeAttr('disabled'); }}); $waitlistTable_checks_header.on('change', function(){ if($(this).attr("checked")!==undefined){ $waitlistTable_checks.attr('checked', 'checked'); }else{ $waitlistTable_checks.removeAttr('checked'); } var selectedNum=$waitlistTable.find('tbody .check-column > input:checked').length; if(selectedNum===0){ jQuery('#author_waitlist_unsubscribe').attr('disabled', 'disabled'); }else{ jQuery('#author_waitlist_unsubscribe').removeAttr('disabled'); }}); }}); }(jQuery)); !function(){function e(){var e=jQuery(window).height();jQuery(window).width()>768&&(jQuery("body").hasClass("admin-bar")?jQuery(".woocommerce-cart-tab-container .widget_shopping_cart").css("height",e-32):jQuery(".woocommerce-cart-tab-container .widget_shopping_cart").css("height",e))}jQuery(document).mouseup(function(e){var o=jQuery(".woocommerce-cart-tab-container");jQuery(".button.add_to_cart_button").is(e.target)||o.is(e.target)||0!==o.has(e.target).length||!o.hasClass("woocommerce-cart-tab-container--visible")||(o.removeClass("woocommerce-cart-tab-container--visible"),jQuery("body").removeClass("woocommerce-cart-tab-is-visible"))}),jQuery(document).ready(function(){jQuery("body").on("added_to_cart",function(){!function(){if(jQuery(window).width()>768){if(jQuery(".woocommerce-cart-tab-container").hasClass("woocommerce-cart-tab-container--visible"))return;jQuery(".woocommerce-cart-tab-container").addClass("woocommerce-cart-tab-container--visible"),jQuery("body").toggleClass("woocommerce-cart-tab-is-visible")}}()}),e(),jQuery("body").on("removed_from_cart",function(){null==Cookies.get("woocommerce_items_in_cart")&&(jQuery(window).width()>768&&jQuery(".woocommerce-cart-tab-container").removeClass("woocommerce-cart-tab-container--visible"),jQuery("body").toggleClass("woocommerce-cart-tab-is-visible"))})}),jQuery(window).resize(function(){e()})}(); (function(w){"use strict";var loadCSS=function(href,before,media){var doc=w.document;var ss=doc.createElement("link");var ref;if(before){ref=before}else{var refs=(doc.body||doc.getElementsByTagName("head")[0]).childNodes;ref=refs[refs.length-1]}var sheets=doc.styleSheets;ss.rel="stylesheet";ss.href=href;ss.media="only x";function ready(cb){if(doc.body){return cb()}setTimeout(function(){ready(cb)})}ready(function(){ref.parentNode.insertBefore(ss,before?ref:ref.nextSibling)});var onloadcssdefined=function(cb){var resolvedHref=ss.href;var i=sheets.length;while(i--){if(sheets[i].href===resolvedHref){return cb()}}setTimeout(function(){onloadcssdefined(cb)})};function loadCB(){if(ss.addEventListener){ss.removeEventListener("load",loadCB)}ss.media=media||"all"}if(ss.addEventListener){ss.addEventListener("load",loadCB)}ss.onloadcssdefined=onloadcssdefined;onloadcssdefined(loadCB);return ss};if(typeof exports!=="undefined"){exports.loadCSS=loadCSS}else{w.loadCSS=loadCSS}})(typeof global!=="undefined"?global:this);(function($){"use strict";$(function(){if("undefined"!==typeof WpDisableAsyncLinks&&Object.keys(WpDisableAsyncLinks).length){var key;for(key in WpDisableAsyncLinks){if(WpDisableAsyncLinks.hasOwnProperty(key)){loadCSS(WpDisableAsyncLinks[key])}}}})})(jQuery);